/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.gmao.entities;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Amine
 */
@Entity
@Table(name = "arret_machine")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "ArretMachine.findAll", query = "SELECT a FROM ArretMachine a"),
    @NamedQuery(name = "ArretMachine.findByNumero", query = "SELECT a FROM ArretMachine a WHERE a.numero = :numero"),
    @NamedQuery(name = "ArretMachine.findByDateDebut", query = "SELECT a FROM ArretMachine a WHERE a.dateDebut = :dateDebut"),
    @NamedQuery(name = "ArretMachine.findByDateFin", query = "SELECT a FROM ArretMachine a WHERE a.dateFin = :dateFin"),
    @NamedQuery(name = "ArretMachine.findByIdentifiantArret", query = "SELECT a FROM ArretMachine a WHERE a.identifiantArret = :identifiantArret")})
public class ArretMachine implements Serializable {
    private static final long serialVersionUID = 1L;
    @Column(name = "numero")
    private Integer numero;
    @Column(name = "date_debut")
    @Temporal(TemporalType.DATE)
    private Date dateDebut;
    @Column(name = "date_fin")
    @Temporal(TemporalType.DATE)
    private Date dateFin;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "identifiant_arret")
    private Integer identifiantArret;
    @OneToMany(mappedBy = "identifiantArret")
    private List<Intervention> interventionList;
    @JoinColumn(name = "id_machine", referencedColumnName = "id_machine")
    @ManyToOne
    private Machine idMachine;
    @JoinColumn(name = "ident_intervention", referencedColumnName = "ident_intervention")
    @ManyToOne
    private Intervention identIntervention;

    public ArretMachine() {
    }

    public ArretMachine(Integer identifiantArret) {
        this.identifiantArret = identifiantArret;
    }

    public Integer getNumero() {
        return numero;
    }

    public void setNumero(Integer numero) {
        this.numero = numero;
    }

    public Date getDateDebut() {
        return dateDebut;
    }

    public void setDateDebut(Date dateDebut) {
        this.dateDebut = dateDebut;
    }

    public Date getDateFin() {
        return dateFin;
    }

    public void setDateFin(Date dateFin) {
        this.dateFin = dateFin;
    }

    public Integer getIdentifiantArret() {
        return identifiantArret;
    }

    public void setIdentifiantArret(Integer identifiantArret) {
        this.identifiantArret = identifiantArret;
    }

    @XmlTransient
    public List<Intervention> getInterventionList() {
        return interventionList;
    }

    public void setInterventionList(List<Intervention> interventionList) {
        this.interventionList = interventionList;
    }

    public Machine getIdMachine() {
        return idMachine;
    }

    public void setIdMachine(Machine idMachine) {
        this.idMachine = idMachine;
    }

    public Intervention getIdentIntervention() {
        return identIntervention;
    }

    public void setIdentIntervention(Intervention identIntervention) {
        this.identIntervention = identIntervention;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (identifiantArret != null ? identifiantArret.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ArretMachine)) {
            return false;
        }
        ArretMachine other = (ArretMachine) object;
        if ((this.identifiantArret == null && other.identifiantArret != null) || (this.identifiantArret != null && !this.identifiantArret.equals(other.identifiantArret))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.gmao.entities.ArretMachine[ identifiantArret=" + identifiantArret + " ]";
    }
    
}
